package com.qf.service.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.qf.Movie;
import com.qf.ResultVo;
import com.qf.mapper.MovieInfoMapper;
import com.qf.service.MovieInfoService;
import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 作者：Xx凯丶
 * 时间：2022/4/21 15:09
 */
@Service
public class MovieInfoServiceImpl implements MovieInfoService {
    @Autowired
    private MovieInfoMapper movieInfoMapper;
//    @Autowired
//    private StringRedisTemplate template;
    @Override
    public ResultVo searchMoviesByCinemaId(Integer cinemaId) {
        List<Movie> movies = movieInfoMapper.queryMovieInfoByCinemaId(cinemaId);
        movies.forEach(movie -> {
            List<String> types = movieInfoMapper.queryTypeByMovieId(movie.getMovieId());
            movie.setTypes(types);
            List<String> acNamec = movieInfoMapper.queryAcNameByMovieId(movie.getMovieId());
            movie.setAcName(acNamec);
        });
        return new ResultVo(200,"SUCCESS",movies);
    }
}
